FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build

WORKDIR /src
COPY ["src/HiShing.TongDanGuanJia.Web.Host/HiShing.TongDanGuanJia.Web.Host.csproj", "src/HiShing.TongDanGuanJia.Web.Host/"]
COPY ["src/HiShing.TongDanGuanJia.Web.Core/HiShing.TongDanGuanJia.Web.Core.csproj", "src/HiShing.TongDanGuanJia.Web.Core/"]
COPY ["src/HiShing.TongDanGuanJia.Application/HiShing.TongDanGuanJia.Application.csproj", "src/HiShing.TongDanGuanJia.Application/"]
COPY ["src/HiShing.TongDanGuanJia.Core/HiShing.TongDanGuanJia.Core.csproj", "src/HiShing.TongDanGuanJia.Core/"]
COPY ["src/HiShing.TongDanGuanJia.EntityFrameworkCore/HiShing.TongDanGuanJia.EntityFrameworkCore.csproj", "src/HiShing.TongDanGuanJia.EntityFrameworkCore/"]
WORKDIR "/src/src/HiShing.TongDanGuanJia.Web.Host"
RUN dotnet restore 

WORKDIR /src
COPY ["src/HiShing.TongDanGuanJia.Web.Host", "src/HiShing.TongDanGuanJia.Web.Host"]
COPY ["src/HiShing.TongDanGuanJia.Web.Core", "src/HiShing.TongDanGuanJia.Web.Core"]
COPY ["src/HiShing.TongDanGuanJia.Application", "src/HiShing.TongDanGuanJia.Application"]
COPY ["src/HiShing.TongDanGuanJia.Core", "src/HiShing.TongDanGuanJia.Core"]
COPY ["src/HiShing.TongDanGuanJia.EntityFrameworkCore", "src/HiShing.TongDanGuanJia.EntityFrameworkCore"]
WORKDIR "/src/src/HiShing.TongDanGuanJia.Web.Host"
RUN dotnet publish -c Release -o /publish --no-restore

FROM mcr.microsoft.com/dotnet/aspnet:7.0
EXPOSE 80
WORKDIR /app
COPY --from=build /publish .
ENTRYPOINT ["dotnet", "HiShing.TongDanGuanJia.Web.Host.dll"]
